3.11.53 \(\int (a+i a \tan (e+f x))^m (c-i c \tan (e+f x))^2 \, dx\) [1053]

Optimal. Leaf size=64 \[ -\frac {2 i c^2 (a+i a \tan (e+f x))^m}{f m}+\frac {i c^2 (a+i a \tan (e+f x))^{1+m}}{a f (1+m)} \]

[Out]

-2*I*c^2*(a+I*a*tan(f*x+e))^m/f/m+I*c^2*(a+I*a*tan(f*x+e))^(1+m)/a/f/(1+m)

________________________________________________________________________________________

Rubi [A]
time = 0.09, antiderivative size = 64, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, integrand size = 31, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.097, Rules used = {3603, 3568, 45} \begin {gather*} \frac {i c^2 (a+i a \tan (e+f x))^{m+1}}{a f (m+1)}-\frac {2 i c^2 (a+i a \tan (e+f x))^m}{f m} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(a + I*a*Tan[e + f*x])^m*(c - I*c*Tan[e + f*x])^2,x]

[Out]

((-2*I)*c^2*(a + I*a*Tan[e + f*x])^m)/(f*m) + (I*c^2*(a + I*a*Tan[e + f*x])^(1 + m))/(a*f*(1 + m))

Rule 45

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d
*x)^n, x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[m, 0] && ( !IntegerQ[n] || (EqQ[c, 0]
&& LeQ[7*m + 4*n + 4, 0]) || LtQ[9*m + 5*(n + 1), 0] || GtQ[m + n + 2, 0])

Rule 3568

Int[sec[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Dist[1/(a^(m - 2)*b
*f), Subst[Int[(a - x)^(m/2 - 1)*(a + x)^(n + m/2 - 1), x], x, b*Tan[e + f*x]], x] /; FreeQ[{a, b, e, f, n}, x
] && EqQ[a^2 + b^2, 0] && IntegerQ[m/2]

Rule 3603

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((c_) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Di
st[a^m*c^m, Int[Sec[e + f*x]^(2*m)*(c + d*Tan[e + f*x])^(n - m), x], x] /; FreeQ[{a, b, c, d, e, f, n}, x] &&
EqQ[b*c + a*d, 0] && EqQ[a^2 + b^2, 0] && IntegerQ[m] &&  !(IGtQ[n, 0] && (LtQ[m, 0] || GtQ[m, n]))

Rubi steps

\begin {align*} \int (a+i a \tan (e+f x))^m (c-i c \tan (e+f x))^2 \, dx &=\left (a^2 c^2\right ) \int \sec ^4(e+f x) (a+i a \tan (e+f x))^{-2+m} \, dx\\ &=-\frac {\left (i c^2\right ) \text {Subst}\left (\int (a-x) (a+x)^{-1+m} \, dx,x,i a \tan (e+f x)\right )}{a f}\\ &=-\frac {\left (i c^2\right ) \text {Subst}\left (\int \left (2 a (a+x)^{-1+m}-(a+x)^m\right ) \, dx,x,i a \tan (e+f x)\right )}{a f}\\ &=-\frac {2 i c^2 (a+i a \tan (e+f x))^m}{f m}+\frac {i c^2 (a+i a \tan (e+f x))^{1+m}}{a f (1+m)}\\ \end {align*}

________________________________________________________________________________________

Mathematica [B] Both result and optimal contain complex but leaf count is larger than twice the leaf count of optimal. \(131\) vs. \(2(64)=128\).
time = 41.63, size = 131, normalized size = 2.05 \begin {gather*} -\frac {i 2^{1+m} c^2 e^{-i (e+f x)} \left (e^{i f x}\right )^m \left (\frac {e^{i (e+f x)}}{1+e^{2 i (e+f x)}}\right )^{1+m} \left (1+e^{2 i (e+f x)}+m\right ) \sec ^{-m}(e+f x) (\cos (f x)+i \sin (f x))^{-m} (a+i a \tan (e+f x))^m}{f m (1+m)} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(a + I*a*Tan[e + f*x])^m*(c - I*c*Tan[e + f*x])^2,x]

[Out]

((-I)*2^(1 + m)*c^2*(E^(I*f*x))^m*(E^(I*(e + f*x))/(1 + E^((2*I)*(e + f*x))))^(1 + m)*(1 + E^((2*I)*(e + f*x))
 + m)*(a + I*a*Tan[e + f*x])^m)/(E^(I*(e + f*x))*f*m*(1 + m)*Sec[e + f*x]^m*(Cos[f*x] + I*Sin[f*x])^m)

________________________________________________________________________________________

Maple [A]
time = 0.94, size = 78, normalized size = 1.22

method result size
norman \(-\frac {c^{2} \tan \left (f x +e \right ) {\mathrm e}^{m \ln \left (a +i a \tan \left (f x +e \right )\right )}}{f \left (1+m \right )}-\frac {i \left (c^{2} m +2 c^{2}\right ) {\mathrm e}^{m \ln \left (a +i a \tan \left (f x +e \right )\right )}}{f m \left (1+m \right )}\) \(78\)
risch \(\text {Expression too large to display}\) \(1604\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+I*a*tan(f*x+e))^m*(c-I*c*tan(f*x+e))^2,x,method=_RETURNVERBOSE)

[Out]

-c^2/f/(1+m)*tan(f*x+e)*exp(m*ln(a+I*a*tan(f*x+e)))-I/f/m/(1+m)*(c^2*m+2*c^2)*exp(m*ln(a+I*a*tan(f*x+e)))

________________________________________________________________________________________

Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))^m*(c-I*c*tan(f*x+e))^2,x, algorithm="maxima")

[Out]

integrate((-I*c*tan(f*x + e) + c)^2*(I*a*tan(f*x + e) + a)^m, x)

________________________________________________________________________________________

Fricas [A]
time = 0.93, size = 89, normalized size = 1.39 \begin {gather*} -\frac {2 \, {\left (i \, c^{2} m + i \, c^{2} e^{\left (2 i \, f x + 2 i \, e\right )} + i \, c^{2}\right )} \left (\frac {2 \, a e^{\left (2 i \, f x + 2 i \, e\right )}}{e^{\left (2 i \, f x + 2 i \, e\right )} + 1}\right )^{m}}{f m^{2} + f m + {\left (f m^{2} + f m\right )} e^{\left (2 i \, f x + 2 i \, e\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))^m*(c-I*c*tan(f*x+e))^2,x, algorithm="fricas")

[Out]

-2*(I*c^2*m + I*c^2*e^(2*I*f*x + 2*I*e) + I*c^2)*(2*a*e^(2*I*f*x + 2*I*e)/(e^(2*I*f*x + 2*I*e) + 1))^m/(f*m^2
+ f*m + (f*m^2 + f*m)*e^(2*I*f*x + 2*I*e))

________________________________________________________________________________________

Sympy [B] Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 313 vs. \(2 (49) = 98\).
time = 0.46, size = 313, normalized size = 4.89 \begin {gather*} \begin {cases} x \left (i a \tan {\left (e \right )} + a\right )^{m} \left (- i c \tan {\left (e \right )} + c\right )^{2} & \text {for}\: f = 0 \\- \frac {2 c^{2} f x \tan {\left (e + f x \right )}}{2 a f \tan {\left (e + f x \right )} - 2 i a f} + \frac {2 i c^{2} f x}{2 a f \tan {\left (e + f x \right )} - 2 i a f} + \frac {i c^{2} \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )} \tan {\left (e + f x \right )}}{2 a f \tan {\left (e + f x \right )} - 2 i a f} + \frac {c^{2} \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 a f \tan {\left (e + f x \right )} - 2 i a f} + \frac {4 c^{2}}{2 a f \tan {\left (e + f x \right )} - 2 i a f} & \text {for}\: m = -1 \\2 c^{2} x - \frac {i c^{2} \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{f} - \frac {c^{2} \tan {\left (e + f x \right )}}{f} & \text {for}\: m = 0 \\- \frac {c^{2} m \left (i a \tan {\left (e + f x \right )} + a\right )^{m} \tan {\left (e + f x \right )}}{f m^{2} + f m} - \frac {i c^{2} m \left (i a \tan {\left (e + f x \right )} + a\right )^{m}}{f m^{2} + f m} - \frac {2 i c^{2} \left (i a \tan {\left (e + f x \right )} + a\right )^{m}}{f m^{2} + f m} & \text {otherwise} \end {cases} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))**m*(c-I*c*tan(f*x+e))**2,x)

[Out]

Piecewise((x*(I*a*tan(e) + a)**m*(-I*c*tan(e) + c)**2, Eq(f, 0)), (-2*c**2*f*x*tan(e + f*x)/(2*a*f*tan(e + f*x
) - 2*I*a*f) + 2*I*c**2*f*x/(2*a*f*tan(e + f*x) - 2*I*a*f) + I*c**2*log(tan(e + f*x)**2 + 1)*tan(e + f*x)/(2*a
*f*tan(e + f*x) - 2*I*a*f) + c**2*log(tan(e + f*x)**2 + 1)/(2*a*f*tan(e + f*x) - 2*I*a*f) + 4*c**2/(2*a*f*tan(
e + f*x) - 2*I*a*f), Eq(m, -1)), (2*c**2*x - I*c**2*log(tan(e + f*x)**2 + 1)/f - c**2*tan(e + f*x)/f, Eq(m, 0)
), (-c**2*m*(I*a*tan(e + f*x) + a)**m*tan(e + f*x)/(f*m**2 + f*m) - I*c**2*m*(I*a*tan(e + f*x) + a)**m/(f*m**2
 + f*m) - 2*I*c**2*(I*a*tan(e + f*x) + a)**m/(f*m**2 + f*m), True))

________________________________________________________________________________________

Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))^m*(c-I*c*tan(f*x+e))^2,x, algorithm="giac")

[Out]

integrate((-I*c*tan(f*x + e) + c)^2*(I*a*tan(f*x + e) + a)^m, x)

________________________________________________________________________________________

Mupad [B]
time = 0.37, size = 112, normalized size = 1.75 \begin {gather*} -\frac {c^2\,{\left (\frac {a\,\left (\cos \left (2\,e+2\,f\,x\right )+1+\sin \left (2\,e+2\,f\,x\right )\,1{}\mathrm {i}\right )}{\cos \left (2\,e+2\,f\,x\right )+1}\right )}^m\,\left (m\,1{}\mathrm {i}+\cos \left (2\,e+2\,f\,x\right )\,2{}\mathrm {i}+m\,\cos \left (2\,e+2\,f\,x\right )\,1{}\mathrm {i}+m\,\sin \left (2\,e+2\,f\,x\right )+2{}\mathrm {i}\right )}{f\,m\,\left (\cos \left (2\,e+2\,f\,x\right )+1\right )\,\left (m+1\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a + a*tan(e + f*x)*1i)^m*(c - c*tan(e + f*x)*1i)^2,x)

[Out]

-(c^2*((a*(cos(2*e + 2*f*x) + sin(2*e + 2*f*x)*1i + 1))/(cos(2*e + 2*f*x) + 1))^m*(m*1i + cos(2*e + 2*f*x)*2i
+ m*cos(2*e + 2*f*x)*1i + m*sin(2*e + 2*f*x) + 2i))/(f*m*(cos(2*e + 2*f*x) + 1)*(m + 1))

________________________________________________________________________________________